Don't hardwire the supported text targets here, use
authorMatthias Clasen <mclasen@redhat.com>
Fri, 29 Oct 2004 05:14:00 +0000 (05:14 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Fri, 29 Oct 2004 05:14:00 +0000 (05:14 +0000)
2004-10-29  Matthias Clasen  <mclasen@redhat.com>

* gtk/gtkclipboard.c (gtk_clipboard_set_text): Don't hardwire
the supported text targets here, use
gtk_target_list_add_text_targets().  (#156404)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkclipboard.c

index c95b077eb608030dadf2ca4eb3c3143f96a1977f..25cf5d8d4a2dc8d061ddf71e1ee1761c8b300e98 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2004-10-29  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkclipboard.c (gtk_clipboard_set_text): Don't hardwire
+       the supported text targets here, use 
+       gtk_target_list_add_text_targets().  (#156404)
+
        * gtk/gtkliststore.c (gtk_list_store_reorder): Don't
        loop over the sentinel node.  (#156298, Torsten Schoenfeld)
 
index c95b077eb608030dadf2ca4eb3c3143f96a1977f..25cf5d8d4a2dc8d061ddf71e1ee1761c8b300e98 100644 (file)
@@ -1,5 +1,9 @@
 2004-10-29  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkclipboard.c (gtk_clipboard_set_text): Don't hardwire
+       the supported text targets here, use 
+       gtk_target_list_add_text_targets().  (#156404)
+
        * gtk/gtkliststore.c (gtk_list_store_reorder): Don't
        loop over the sentinel node.  (#156298, Torsten Schoenfeld)
 
index c95b077eb608030dadf2ca4eb3c3143f96a1977f..25cf5d8d4a2dc8d061ddf71e1ee1761c8b300e98 100644 (file)
@@ -1,5 +1,9 @@
 2004-10-29  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkclipboard.c (gtk_clipboard_set_text): Don't hardwire
+       the supported text targets here, use 
+       gtk_target_list_add_text_targets().  (#156404)
+
        * gtk/gtkliststore.c (gtk_list_store_reorder): Don't
        loop over the sentinel node.  (#156298, Torsten Schoenfeld)
 
index c95b077eb608030dadf2ca4eb3c3143f96a1977f..25cf5d8d4a2dc8d061ddf71e1ee1761c8b300e98 100644 (file)
@@ -1,5 +1,9 @@
 2004-10-29  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkclipboard.c (gtk_clipboard_set_text): Don't hardwire
+       the supported text targets here, use 
+       gtk_target_list_add_text_targets().  (#156404)
+
        * gtk/gtkliststore.c (gtk_list_store_reorder): Don't
        loop over the sentinel node.  (#156298, Torsten Schoenfeld)
 
index ce3dbba6a685a920a01e2602c18e219a18019387..cc78e1f84730b8e67693a12f15197e101c452e2b 100644 (file)
@@ -719,24 +719,38 @@ gtk_clipboard_set_text (GtkClipboard *clipboard,
                        const gchar  *text,
                        gint          len)
 {
-  static const GtkTargetEntry targets[] = {
-    { "STRING", 0, TARGET_STRING },
-    { "TEXT",   0, TARGET_TEXT }, 
-    { "COMPOUND_TEXT", 0, TARGET_COMPOUND_TEXT },
-    { "UTF8_STRING", 0, TARGET_UTF8_STRING }
-  };
+  GtkTargetList *list;
+  GList *l;
+  GtkTargetEntry *targets;
+  gint n_targets, i;
 
   g_return_if_fail (clipboard != NULL);
   g_return_if_fail (text != NULL);
-  
+
+  list = gtk_target_list_new (NULL, 0);
+  gtk_target_list_add_text_targets (list, 0);
+
+  n_targets = g_list_length (list->list);
+  targets = g_new (GtkTargetEntry, n_targets);
+  for (l = list->list, i = 0; l; l = l->next, i++)
+    {
+      GtkTargetPair *pair = (GtkTargetPair *)l->data;
+      targets[i].target = gdk_atom_name (pair->target);
+      targets[i].flags = 0;
+      targets[i].info = 0;
+    }
+
   if (len < 0)
     len = strlen (text);
   
   gtk_clipboard_set_with_data (clipboard, 
-                              targets, G_N_ELEMENTS (targets),
+                              targets, n_targets,
                               text_get_func, text_clear_func,
                               g_strndup (text, len));
   gtk_clipboard_set_can_store (clipboard, NULL, 0);
+
+  g_free (targets);
+  gtk_target_list_unref (list);
 }
 
 static void